<%@ page import="dao.customerDao.CustomerDaoImpl" %>
<%@ page import="model.Customer" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="dao.DaoException" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<table class="layui-table">
    <!-- <colgroup>
      <col width="120" />
      <col width="200" />
      <col />
    </colgroup> -->
    <thead>
    <tr>
        <th>ID</th>
        <th>用户名</th>
        <th>Email</th>
        <th>余额</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <%
        CustomerDaoImpl dao = new CustomerDaoImpl();
        try {

            ArrayList<Customer> customers = dao.findCustomerByPage(1, 10);
            for (Customer customer : customers) {
    %>
    <tr>
        <td><%=customer.getId()%>
        </td>
        <td><%=customer.getName()%>
        </td>
        <td><%=customer.getEmail()%>
        </td>
        <td><%=customer.getBalance()%>
        </td>
        <td><a style="color: blue" href="/deleteCustomer?id=<%=customer.getId()%>">删除记录</a></td>
    </tr>
    <%
            }
        } catch (DaoException e) {
            e.printStackTrace();
        }
    %>
    </tbody>
</table>
